<?php

class RoleRecord extends TActiveRecord
{
	const TABLE = 'roles';
	
	// fields
	public $id;
	public $title;
	public $description;
	
	public function setId($id)                              { $this->id = $id; }
	public function setTitle($title)                        { $this->title = $title; }
	public function setDescription($description)            { $this->description = $description; }
	
	public function getId()            { return $this->id; }
	public function getTitle()         { return $this->title; }
	public function getDescription()   { return $this->description; }
	
	public function setData($id, $title, $description)
	{
		$this->id           = $id;
		$this->title        = $title;
		$this->description  = $description;
	}
	
	public function setDataByRoleRecord($record)
	{
		if($record instanceof RoleRecord)
		{
			$this->setData($record->getId(), $record->getTitle(), $record->getDescription());
		}
	}
	
	public function equals($roleRecord)
	{
		if($roleRecord instanceof RoleRecord)
		{
			return	$this->getTitle() == $roleRecord->getTitle()	&&
					$this->getDescription() == $roleRecord->getDescription();
		}
		return false;
	}
	
	public static function finder($className=__CLASS__)
	{
		return parent::finder($className);
	}
}

?>